package com.huidao.servlet.goodsType;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huidao.service.GoodsTypeService;
import com.huidao.service.GoodsTypeServiceImp;

/**
 * Servlet implementation class delGoodsTypeServlet
 */
public class delGoodsTypeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public delGoodsTypeServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String gId = request.getParameter("gtypeid");
		long gtypeId=1;
		if(gId!=null){
			 gtypeId =Long.parseLong(gId); 
		}
		GoodsTypeService gs = new GoodsTypeServiceImp();
		String data = gs.delGoodsType(gtypeId);
		if(data.equals("")){
			response.sendRedirect("GetListGoodsType?currentpage="+request.getParameter("currentpage"));
		}else{
			response.getWriter().print(data);
		}
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}

}
